import {
    createApp
} from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import SvgIcon from '@/icons'
import '@/assets/styles/reset.css'
// import "@/router/permission"
// import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
// import { library } from '@fortawesome/fontawesome-svg-core'
// import { faUserSecret } from '@fortawesome/free-solid-svg-icons'
// import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import directive from "@/directive"
import { download } from '@/utils/request'
import i18n from './locales'
// 分页组件
import Pagination from '@/components/Pagination/index.vue'
// 注册指令
import plugins from './plugins' // plugins

import { parseTime, resetForm, addDateRange, handleTree, selectDictLabel, selectDictLabels } from '@/utils/ruoyi.js'
// 自定义树选择组件
import TreeSelect from '@/components/TreeSelect/index.vue'
// library.add(faUserSecret)
// 富文本组件
import Editor from "@/components/Editor"
// 自定义表格工具组件
import RightToolbar from '@/components/RightToolbar'

// 自定义时间组件
import ScrollTime from '@/components/ScrollTime'
// 自定义天气组件
import Weather from '@/components/Weather'
//考试倒计时插件
import CountDown from '@/components/CountDown'

const app = createApp(App);
// app.component('font-awesome-icon', FontAwesomeIcon)
app.component('Pagination', Pagination)
app.component('TreeSelect', TreeSelect)
app.component('RightToolbar', RightToolbar)
app.component('Editor', Editor)
app.component('ScrollTime', ScrollTime)
app.component('Weather', Weather)
app.component('CountDown', CountDown)


app.config.errorHandler = (err, vm, info) => {
    // 在此处处理错误
    console.log("err:",err)
  }
  // 全局方法挂载
app.config.globalProperties.parseTime = parseTime
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
app.config.globalProperties.selectDictLabels = selectDictLabels
app.config.globalProperties.download = download

SvgIcon(app);
directive(app)
app.use(ElementPlus)
    .use(store)
    .use(router)
    .use(i18n)
    .use(plugins)
    .mount('#app')